package com.yc.util;

import com.yc.biz.BizException;

import java.util.Collection;
import java.util.Map;

public class Utils {
    public static void check(boolean condition, String message) throws BizException {
        if(condition) throw new BizException(message);
    }
    public static void checkEmpty(Object value, String message) throws BizException {
        if (value == null) throw new BizException(message);
          if(value instanceof String){
              check(((String) value).isBlank(),message);
          }
        if(value instanceof Collection){
            check(((Collection) value).isEmpty(),message);
        }
        if(value instanceof Map){
            check(((Map) value).isEmpty(),message);
        }
    }
}
